package com.doudoukeji.service.Activity.splash;


import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.doudoukeji.service.Activity.Login.loginActivity;
import com.doudoukeji.service.R;
import com.doudoukeji.service.Utils.SharedPreferencesUtils;

/**
 * @version 2.0
 * @类描述： 引导页
 * @项目名称：douDouTech
 * @类名称： SplashActivity
 * @包名称： com.doudoukeji.service.Activity.splash
 * @创建人：张强 boy
 * @创建时间：2016/3/7 16:40
 * @修改人：
 * @修改时间：2016/3/7 16:40
 * @修改备注： new parent class(用一句话描述修改了什么)
 */
@SuppressLint("ValidFragment")
public class PageOfGuideFragment extends Fragment {
    private View view;
    private int type;
    private Button mBtnConfirm;

    public PageOfGuideFragment(int type) {
        this.type = type;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (type == 0) {
            view = View.inflate(this.getActivity(), R.layout.fragment_firstpageofguide,
                    null);
        } else if (type == 1) {
            view = View.inflate(this.getActivity(), R.layout.fragment_secondpageofguide,
                    null);
        } else {
            view = View.inflate(getActivity(), R.layout.fragment_thirdpageofguide,
                    null);
            mBtnConfirm = (Button) view.findViewById(R.id.btn_confirm);
            mBtnConfirm.setBackgroundResource(R.drawable.btn_home_selector);
            mBtnConfirm.setText("开始体验");
            mBtnConfirm.setTextSize(20);
            mBtnConfirm.setTextColor(Color.parseColor("#ffffff"));
            mBtnConfirm.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(getActivity(), loginActivity.class);
                    startActivity(intent);
                    SharedPreferencesUtils.setParam(getActivity(),"isFirst","1");
                    getActivity().finish();
                }
            });
        }
        return view;
    }


}
